package model

import "time"

type BorrowStatus string

const (
	BorrowedStatus BorrowStatus = "BORROWED"
	ReturnedStatus BorrowStatus = "RETURNED"
	OverdueStatus  BorrowStatus = "OVERDUE"
)

type BorrowRecord struct {
	ID        uint         `gorm:"primaryKey" json:"id"`
	BookID    uint         `gorm:"index" json:"book_id"`
	UserID    uint         `gorm:"index" json:"user_id"`
	BorrowAt  time.Time    `json:"borrow_at"`
	ReturnAt  *time.Time   `json:"return_at"`
	DueAt     time.Time    `json:"due_at"`
	Status    BorrowStatus `gorm:"type:ENUM('BORROWED','RETURNED','OVERDUE');default:'BORROWED'" json:"status"`
	CreatedAt time.Time    `gorm:"autoCreateTime" json:"created_at"`
}
